package com.szu.subject.ui.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.szu.subject.domains.Course;
import com.szu.subject.ui.mapper.CourseMapper;
import com.szu.subject.ui.service.CourseService;

/**
 * course 的service层
 * 
 * @author Shenxiaolin
 *
 */
@Service
public class CourseServiceImpl implements CourseService {

	@Autowired
	private CourseMapper courseMapper;

	@Override
	public Course getByPK(Long id) {
		return courseMapper.getCourseByPK(id);/*根据课程ID,返回课程*/
	}
	
	@Override
	public Course getCourseByAccount(String account) {
		return courseMapper.getCourseByAccount(account);/*根据课程account,返回课程*/
	}
	
	@Override
	public List<Course> getCourseByName(String courseName){
		return courseMapper.getCourseByName(courseName);
	}
	
	@Override
	public List<Course> getCoursesByCollege(Long id){
		return courseMapper.getCoursesByCollege(id);
	}
	
	@Override
	public List<Course> getCoursesByTeacherName(String teacherName){
		return courseMapper.getCoursesByTeacherName(teacherName);
	}
	
	@Override
	public Course createCourse(Course course){
		courseMapper.createCourse(course);
		return course;
	}

	@Override
	public Course updateCourse(Course course){
		courseMapper.updateCourse(course);
		return course;
	}	

	@Override
	public int deleteCourse(Long id){
		return courseMapper.deleteCourse(id);
	}
	
	@Override
	public List<Course> batchCreateCourses(List<Course> courses){
		courseMapper.batchcreateCourses(courses);
		return courses;
	}
	
	@Override
	public List<Course> batchUpdateCourses(List<Course> courses){
		courseMapper.batchupdateCourses(courses);
		return courses;
	}
	
	@Override
	public int batchDeleteCourses(List<Long> id){
		return courseMapper.batchdeleteCourses(id);
	}

	@Override
	public List<Course> getCoursesByClassTIme(String classTime) {
		return courseMapper.getCoursesByClassTime(classTime);
	}

	@Override
	public List<Course> getCoursesByIdList(List<Long> coursesId) {
		return courseMapper.getCoursesByPKList(coursesId);
	}

	@Override
	public List<Course> getAllCourses() {
		return courseMapper.getAllCourses();
	}
}
